Android Things Projects by Francesco Azzola

Android Things Projects by Francesco Azzola

Author:Francesco Azzola [Azzola, Francesco]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2017-06-30T04:00:00+00:00


private void createQueue() {

if (queue == null)

queue = Volley.newRequestQueue(

ctx.getApplicationContext());

}

Here, the queue is defined as follows:

private RequestQueue queue;

Once we have configured the request queue, we can focus on implementing the method that sends data. To this purpose, add the sendData() method to this class. This is the heart of the class because it invokes the Artik Rest APIs using the message structure described previously. Before writing this method, it is worthwhile to split it into several steps, because it can improve its readability. The steps are: Create an instance of StringRequest that represents the request we want to send.

Override the getHeaders()method to customize the HTTP request headers.

Override the getBody()method to customize the body we are sending.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.